{extend name="../../admin/view/main"}

{block name='content'}
<form action="{:sysuri()}" class="layui-card layui-form" data-auto="true" method="post">
    <div class="layui-card-body">

        <!--{notempty name='marks'}-->
        <div class="layui-form-item label-required-prev">
            <span class="help-label"><b>文章标签</b>News Mark</span>
            <div class="layui-textarea help-checks">
                {foreach $marks as $tag}{if isset($vo.mark) && is_array($vo.mark) && in_array($tag.name, $vo.mark)}
                <label class="think-checkbox notselect"><input checked lay-ignore name="mark[]" type="checkbox" value="{$tag.name}"> {$tag.name}</label>
                {else}
                <label class="think-checkbox notselect"><input lay-ignore name="mark[]" type="checkbox" value="{$tag.name}"> {$tag.name}</label>
                {/if}{/foreach}
            </div>
        </div>
        <!--{/notempty}-->

        <div class="layui-form-item label-required-prev">
            <span class="help-label"><b>文章封面</b>News Conver</span>
            <div class="relative block label-required-null">
                <input class="layui-input think-bg-gray" name="cover" placeholder="请上传文章封面" readonly required value='{$vo.cover|default=""}'>
                <a class="layui-icon layui-icon-upload input-right-icon" data-file data-field="cover" data-type="gif,png,jpg,jpeg"></a>
            </div>
        </div>

        <label class="layui-form-item relative block">
            <span class="help-label"><b>文章标题</b>News Title</span>
            <input class="layui-input" name="name" placeholder="请输入文章标题" required value='{$vo.name|default=""}'>
        </label>

        <div class="layui-form-item label-required-prev">
            <span class="help-label"><b>文章内容</b>News Content</span>
            <div class="relative block">
                <textarea class="layui-hide" name="content" placeholder="请输入文章内容">{$vo.content|default=''}</textarea>
            </div>
        </div>

        <div class="hr-line-dashed"></div>
        {notempty name='vo.id'}<input name='id' type='hidden' value='{$vo.id}'>{/notempty}

        <div class="layui-form-item text-center">
            <button class="layui-btn" type="submit">保存数据</button>
            <button class="layui-btn layui-btn-danger" data-history-back data-confirm="确定要取消编辑吗？" type='button'>取消编辑</button>
        </div>
    </div>

</form>

<script>
    $('input[name="cover"]').uploadOneImage();
    require(['ckeditor'], function () {
        window.createEditor('[name=content]', {height: 350})
    });
</script>
{/block}
